`timescale 1ns / 1ps
module testbench;
    import "DPI-C" function void hello();
    //import "DPI-C" function void readfile(svLogicVecVal*in_a, svLogicVecVal*in_b);
    //import "DPI-C" function void writefile(const svLogicVecVal* out, const svLogicVecVal* valid);
    import "DPI-C" function void writefile_int(input int out, input int valid);
    import "DPI-C" function void readfile_int(output int in_a, output int in_b);
    logic clk;
    logic rst;
    logic [7:0] out;
    logic [7:0] in_a;
    logic [7:0] in_b;

    logic [0:0] valid = 1;

    my_adder uut (
        .clk(clk),
        .rst(rst),
        .in_a(in_a),
        .in_b(in_b),
        .out(out)
    );

    always #5 clk = ~clk;

    int in_a_c;
    int in_b_c;
    int out_c;
    int valid_c;


    initial begin
        $display("hello world!!");
        clk = 0;
        rst = 0;
        #10
        rst = 1;
        #10
        rst = 0;
        #10

        readfile_int(in_a_c, in_b_c);
        in_a = in_a_c;
        in_b = in_b_c;
        $display("in_a_c=%d, in_b_c=%d",in_a_c,in_b_c);
        //readfile(in_a, in_b);
        #20
        out_c = out;
        valid_c = valid;
        writefile_int(out_c, valid_c);
        $display("out = %0d", out);
        #20
        $finish;
    end
endmodule